<extend name="layout/edit" />

<block name="HEADER">
    <style type="text/css">
		.xw__grid .layui-table-view .layui-table td .layui-table-cell{
			height: 50px;
		    line-height: 50px;
		}
		.file-img {
		    height: 100%;
		    background-position: left;
		    background-size: 100% 85%;
		    background-repeat: no-repeat;
		    cursor: pointer;
		}
		#detailedInfoForm .xw-form-formType-div{
			padding: 0 !important;
			padding-left: 5px !important;
		}
		#detailedInfoForm .sections:last-child .table-cell:last-child{ margin-bottom: 0; }
	</style>
</block>

<block name="CONTENT">
    <control:form id="form"/>
</block>

<block name="FOOTER">
   <script type="text/javascript">
	    var  page=(function(ns){
	    	
	    	//分类模板
		    ns.gridClassifyTemplet= function(e){
		    	return "<p style='font-weight: 800;'>"+e.value+"</p>";
		    }
		    
		    //分类模板
		    //名称模板
		    ns.gridNameTemplet= function(e){
		    	var val = e.value;
		    	var str = 
		    		"<div  style='line-height:24px;' onclick='page.openGoods()'>"
			    		+ "<p class='link' style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='"+val+"'>"
			    			+val
			    		+"</p>"
			    		+ "<p style='font-size: 13px;color:#e24444;'>￥"+ $.toDecimal(Number(e.data.goods_sale_price)) +
			    			(function(){
			    				var s = '';
					    			s="<span style='text-decoration:line-through;color: #a7a7a7;margin-left:10px;'>￥"
					    				+$.toDecimal(Number(e.data.goods_oid_price))
					    			+"</span>";
			    				return s;
			    			}())
			    		+ "</p>";
		    		+"</div>";
		    	return str;
		    }
		    
		    //打开商品
		    ns.openGoods = function() {
				setTimeout(function(){
					var selectedRow = form.$grids['goodsGrid'].getSelectedRows()[0];
					var filter = {
						url: "modules/goods/goodsList/edit",
						oid: selectedRow.goods_id,
						mode: 3
					}
					$.openIframe(filter, "商品详情", ['820px', 'calc(100% - 50px)']);
				},100);
			}
		    
	        //保存
	        ns.save=function(){
	            form.save(1).then(function(res){
	            	form.opener.grid.load();
	            });
	        }
	        
	        return ns;
	    }({}));
   </script>
</block>



